package io.adrainty.bolee.framework.commons.basic;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 数据库基类
 * <p>其中创建时间和修改时间为数据库自动新增</p>
 * <p>创建人和修改人通过MybatisPlus拦截器自动填充</p>
 * @author adrainty
 * @version v1.0.0
 * @since 2025/4/16 下午3:48
 */

@Data
@SuppressWarnings("unused")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BaseBO implements Serializable {

    public static final BaseBO DEFAULT_ = new BaseBO();

    @Serial
    private static final long serialVersionUID = 905379142315112488L;

    @TableId(value = "id")
    @Schema(description = "主键ID")
    private Long id;

    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createdTime;

    @TableField(value = "modified_time", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "修改时间")
    private LocalDateTime modifiedTime;

    @TableField(value = "created_by", fill = FieldFill.INSERT)
    @Schema(description = "创建用户")
    private Long createdBy;

    @TableField(value = "modified_by", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "修改用户")
    private Long modifiedBy;

    @TableLogic
    @TableField(value = "is_deleted")
    @Schema(description = "是否删除")
    private Integer isDeleted;

}
